home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
-
-
- main()
- {
- int startingPoint, candidate, i;
- int done, foundFactor;
-
- done = FALSE;
- startingPoint = 19;
- candidate = startingPoint;
-
- while ( ! done )
- {
- candidate++;
-
- foundFactor = FALSE;
- for ( i = 2; i < candidate; i++ )
- {
- if ( (candidate / i) * i == candidate )
- foundFactor = TRUE;
- }
-
- done = (foundFactor == FALSE);
- }
-
- printf( "The next prime after %d is %d. Happy?",
- startingPoint, candidate );
- }